package test.designpattern.staticProxy;

import java.util.Random;

public class RunnerProxy implements IRunner {
    private IRunner runner;

    public RunnerProxy(IRunner runner) {
        this.runner = runner;
    }

    @Override
    public void run() {
        Random random = new Random();
        if (random.nextBoolean()) {
            System.out.println("代理人安排运动员跑步...");
            runner.run();
        } else {
            System.out.println("代理人有事情，不安排运动员跑步了...");
        }
    }
}
